package com.example.xiongmao.mapper;

import com.example.xiongmao.anno.AutoFill;
import com.example.xiongmao.entity.DTO.shopmanager.ShopManagerDTO;
import com.example.xiongmao.entity.DTO.shopmanager.addShopManagerDTO;
import com.example.xiongmao.entity.ShopManager;
import com.example.xiongmao.entity.VO.admin.adminChargeVO;
import com.example.xiongmao.entity.VO.shopmanager.ShopManagerChargeVO;
import com.example.xiongmao.enumeration.OperationType;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ShopManagerChargeMapper {


    List<ShopManagerChargeVO> list(ShopManagerDTO shopManagerDTO);

    @AutoFill(OperationType.INSERT)
    @Insert("insert into shop_managers (username,password,real_name,email,phone,img_url,status) values (#{username},'123456',#{realName},#{email},#{phone},#{imgUrl},#{status})")
    void add(addShopManagerDTO addShopManager);

    @Select("select * from shop_managers where id = #{id}")
    ShopManagerChargeVO getbyId(Integer id);

    @AutoFill(OperationType.UPDATE)
    void updateShopManager(addShopManagerDTO addShopManager);


    void deleteShopManagerBatch(List<Integer> ids);

    @AutoFill(OperationType.UPDATE)
    @Update("update shop_managers set status=0 where id =#{id}")
    void shopManagerDisable(Long id);

    @AutoFill(OperationType.UPDATE)
    @Update("update shop_managers set status=1 where id =#{id}")
    void shopManagerUNDisable(Long id);

    @Select("select * from shop_managers where username=#{username}")
    ShopManager getByUserName(String username);
}
